Inside Macintosh: QuickTime Components

Previous | Chapter Top | Chapter Contents | Next

Creating Previews

Two functions are available for use in creating previews. The PreviewMakePreview function creates previews by allocating a handle to data to be added to the file. On the other hand, the PreviewMakePreviewReference function makes previews by returning the type and identification number of a resource within the file to be used as the preview for the file.

PreviewMakePreview

The PreviewMakePreview function creates previews by allocating a handle to data that is to be added to the file.

pascal ComponentResult PreviewMakePreview (pnotComponent p,
                                         OSType *previewType,
                                         Handle *previewResult,
                                         const FSSpec *sourceFile,
                                         ICMProgressProcRecordPtr progress);
p
Specifies your preview component. You obtain this identifier from the Component Manager's OpenComponent function. See the chapter "Component Manager" in Inside Macintosh: More Macintosh Toolbox for details.
previewType
Contains a pointer to the type of preview component that should be used to display the preview.
previewResult
Contains a pointer to a handle of cached preview data created by this function.
sourceFile
Contains a pointer to a reference to the file for which the preview is created.
progress
Points to a progress function. For details on progress functions, see the chapter "Image Compression Manager" in Inside Macintosh: QuickTime . If the process of creating a preview takes more than a few seconds, you should call the progress function that is provided.

DESCRIPTION

Your preview component should not actually write the preview to the given file. It should simply return the handle. The data is added to the file by the caller.

PreviewMakePreviewReference

Instead of creating a handle to data that is to be added to the file, the PreviewMakePreviewReference function returns the type and identification number of a resource within the file to be used as the preview for the file.

pascal ComponentResult PreviewMakePreviewReference
                                         (pnotComponent p, OSType *previewType,
                                          short *resID, const FSSpec *sourceFile);
p
Specifies your preview component. You obtain this identifier from the Component Manager's OpenComponent function. See the chapter "Component Manager" in Inside Macintosh: More Macintosh Toolbox for details.
previewType
Contains a pointer to the type of preview component that should be used to display the preview.
resID
Contains a pointer to the identification number of a resource within the file to be used as the preview for the file.
sourceFile
Contains a pointer to a reference to the file for which the preview is created.

DESCRIPTION

If your preview component creates previews by reference, you must also implement the PreviewMakePreview function, described in the previous section. However, you should return an error from it. PreviewMakePreview is always called first. If it fails, PreviewMakePreviewReference is tried next .


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next